package org.example.design.test;

//懒汉单例
public class SingletonLazy {
    private static volatile SingletonLazy instance=null;

    private static Object lock=new Object();

    public static SingletonLazy getSingletonLazy(){
        if(instance==null){
            synchronized (lock){
                if(instance==null){
                    instance=new SingletonLazy();
                }
            }
        }
        return instance;
    }

    private SingletonLazy(){}
}
